import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import Loading from './components/loading'

let app = createApp(App)

type Filter = {
    format: <T>(str: T) => string
}

type Lod = {
    show: ()=>void,
    hide:()=>void
}

// 必须要声明文件
declare module '@vue/runtime-core' {
    export interface ComponentCustomProperties {
        $filters: Filter,
        $env:string,
        $loading:Lod
    }
}
// Vue3定义全局函数和变量
app.config.globalProperties.$filters = {
    format<T>(str: T): string {
        return `真.${str}`
    }
}

app.config.globalProperties.$env = 'dev'

app.use(Loading)
app.mount('#app')
